/// 全局状态 * 加载

import { useLoading } from '@expresso/plus'
import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useLoadingStore = defineStore('loading', () => {
  const loading = ref(false)
  const loadingValue = computed(() => loading.value)

  return {
    get value() {
      return loadingValue
    },
    setValue(value: boolean) {
      loading.value = value
    },
    install() {
      useLoading.setGlobalModel(loading)
    },
  }
})
